package cn.itcast.controller;

import cn.itcast.domain.Account;
import cn.itcast.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
public class AccountController {
  @Autowired
   AccountService accountService;
    @RequestMapping("/findlike")
/*   @ResponseBody
    public List<Account> findlike(String name){
        System.out.println(name);
       List<Account> accounts = accountService.findLike(name);
        System.out.println();

        return accounts;
    }*/

    @ResponseBody
    public List<Account> findlike(String name){
        ModelAndView modelAndView=new ModelAndView();
        System.out.println(name);
        System.out.println("hello4654613131325");
        List<Account> accounts = accountService.findLike(name);
/*        System.out.println(accounts);
modelAndView.addObject("accounts",accounts);
modelAndView.setViewName("/list.jsp");*/
//        return "/list.jsp";错误
        return accounts;
    }
}
